import React, { Component } from 'react'
import { Switch, Route, HashRouter, Redirect } from 'react-router-dom'
import { isLogin } from '@utils'
import loadable from 'loadable-components'
export default class extends Component {
  render() {
    return (
      <HashRouter>
        <Switch>
          <Route
            exact
            path="/"
            render={() => <Redirect to={`/${isLogin() ? 'admin' : 'login'}`} />}
          />
          <Route path="/admin" component={loadable(() => import('./Main'))} />
          <Route path="/login" component={loadable(() => import('@/Login'))} />
          <Route component={loadable(() => import('@/NoMatch'))} />
        </Switch>
      </HashRouter>
    )
  }
}
